#include <stdio.h>
#include <gmp.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

int main(int argc, char **argv) {
  mpz_t p;

  mpz_init(p);
  mpz_set_ui(p, 2UL);
  int rank = 1;

  do {
    mpz_nextprime(p, p);
    rank++;
  } while (rank < 10001);

  printf("10001th prime is: ");
  mpz_out_str(stdout, 10, p);
  printf("\n");

  return 0;
}
